#pragma once

#include "Misc/EngineEditorMacros.h"
#include "EditorWindowModel.h"
#include "EditorMainWindowModel.m.h"

class REditorSplitableLayoutModel;
class REditorSplitableLayoutLeafNode;
class REditorSideBarModel;
class REditorPanelModel;
class REditorStatusBarModel;
class REditorNotificationModel;

//store all data of main window
RCLASS(ExtraHeader=["Widgets/Splitable/EditorSplitableLayoutModel.h","AbilityGroup/SideBar/EditorSideBarModel.h","AbilityGroup/Panel/EditorPanelModel.h","StatusBar/EditorStatusBarModel.h","Notification/EditorNotificationModel.h" ])
class ENGINEEDITOR_API REditorMainWindowModel : public REditorWindowModel
{
    ROBJECT

public:

    void FirstTimeInitializeObject() override;


    RFIELD()
    bool bShowActivityBar = true;
    RFIELD()
    EActivityBarPostion ActivityBarPostion = EActivityBarPostion::Left;
  

    //窗口主要布局，管理侧边栏，输出面板，页面区域
    TSharedObjectPtr<REditorSplitableLayoutModel> GetBodyLayout() const;
    

    //主侧边栏
    TSharedObjectPtr<REditorSideBarModel> GetMainSideBar() const;
    void ToggleMainSideBarVisible();
    bool IsMainSideBarVisible() const;

    //副侧边栏
    TSharedObjectPtr<REditorSideBarModel> GetSecondarySideBar() const;
    void ToggleSecondarySideBarVisible();
    bool IsSecondarySideBarVisible() const;

    //输出面板
    TSharedObjectPtr<REditorPanelModel> GetPanel() const;
    void TogglePanelVisible();
    bool IsPanelVisible() const;
    void HidePanel();

    //状态栏
    TSharedObjectPtr<REditorStatusBarModel> GetStatusBar() const;

    //通知
    TSharedObjectPtr<REditorNotificationModel> GetNotification() const;

    void UpdateLayout();
protected:

    RFIELD()
    TSharedObjectPtr<REditorSplitableLayoutModel> BodyLayout;

    RFIELD()
    TSharedObjectPtr<REditorSideBarModel> MainSideBar;

    RFIELD()
    TSharedObjectPtr<REditorSideBarModel> SecondarySideBar;
    
    RFIELD()
    TSharedObjectPtr<REditorPanelModel> Panel;

    RFIELD()
    TSharedObjectPtr<REditorStatusBarModel> StatusBar;

    RFIELD()
    TSharedObjectPtr<REditorNotificationModel> Notification;

//布局相关
    RFIELD()
    TSharedObjectPtr<REditorSplitableLayoutLeafNode> MainSideBarNode;
    
    //隐藏之前的宽度
    RFIELD()
    float MainSideBarNodeWidth = 270;
    RFIELD()
    bool bShowMainSideBar = true;
    RFUNCTION()
    void OnMainSideBarVisibleChangedBySpliter( bool NewVisible);

    RFIELD()
    TSharedObjectPtr<REditorSplitableLayoutLeafNode> PanelNode;
    //隐藏之前的高度
    RFIELD()
    float PanelNodeHeight = 200;
    RFIELD()
    bool bShowPanel = true;
    RFUNCTION()
    void OnPanelVisibleChangedBySpliter( bool NewVisible);

    RFIELD()
    TSharedObjectPtr<REditorSplitableLayoutLeafNode> SecondarySideBarNode;
    //隐藏之前的宽度
    RFIELD()
    float SecondarySideBarNodeWidth = 200;
    RFIELD()
    bool bShowSecondarySideBar = true;
    RFUNCTION()
    void OnSecondarySideBarVisibleChangedBySpliter( bool NewVisible);
};